package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CoursePubDTO;
import com.xuecheng.content.entity.CourseBase;
import com.xuecheng.content.entity.CoursePub;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface CoursePubConvert {

    CoursePubConvert INSTANCE = Mappers.getMapper(CoursePubConvert.class);


    CoursePub courseBase2coursePub(CourseBase courseBase);

    @Mappings({
            @Mapping(source = "startTime", dateFormat = "yyyy-MM-dd HH:mm:ss", target = "startTime"),
            @Mapping(source = "endTime", dateFormat = "yyyy-MM-dd HH:mm:ss", target = "endTime")
    })
    CoursePubDTO entity2dto(CoursePub coursePub);

}